package cn.fengsweb.tokyotyrant
{
	import cn.fengsweb.tokyotyrant.define.TokyoTyrantQueryFunctionName;
	
	import flash.utils.ByteArray;
	
	internal class PutOneNoKey
	{
		private var _obj:Object;
		private var _sendBytes:ByteArray;
		
		public function get sendBytes():ByteArray
		{
			return _sendBytes;
		}
		
		public function PutOneNoKey(obj:Object)
		{
			_obj	= obj;
		}
		
		public function setUid(uid:String):void
		{
			var query:TokyoTyrantQuery	= new TokyoTyrantQuery(TokyoTyrantQueryFunctionName.PUT);
			
			var kbuf:ByteArray	= new ByteArray();
				kbuf.writeBytes(Util.string2Bytes(uid));
			
			query.addArguments(kbuf);
			
			for(var key1:* in _obj){
				query.addArguments(Util.string2Bytes(key1));
				query.addArguments(Util.string2Bytes(_obj[key1]));
			}
			
			_sendBytes	= query.sendBytes;
		}
	}
}